<template>
      <el-card shadow="always">
      <el-button type="primary" icon="el-icon-circle-plus-outline" @click="changeFlag()">新增</el-button>
      <el-divider></el-divider>
      <adminTable @sendPage="sendPage" :adminList="adminList" :size="size" :total="total"></adminTable>
      <adminMudel :showFlag="showFlag" @updateAdmin="updateAdmin"></adminMudel>
      </el-card>
</template>

<script>
import adminTable from './adminTable'
import adminMudel from './adminMudel'

import {mapActions,mapState} from 'vuex'

export default {
    data(){
        return {
            showFlag: {status: false},
            page: 1, 
            size: 5
        }
    },
    computed: {
        ...mapState({"adminList": state => state.admin.adminList,"total": state => state.admin.total})
    },
    methods: {
        ...mapActions('admin',['getAdminAction','getAdminCountAciton']),
        sendPage(page){
            this.page = page
            this.getAdminAction({"page":page,"size":this.size});
        },
        updateAdmin(){
            this.getAdminCountAciton()
            this.getAdminAction({"page":this.page,"size":this.size});
        },
        changeFlag(){
            this.showFlag.status = true
        }
    },
    components: {
        adminTable,
        adminMudel
    },
    created(){
        this.getAdminCountAciton()
        this.getAdminAction({"page":this.page,"size":this.size});
    }
}
</script>

<style>

</style>